Hello and welcome to
this demonstration on using For Each
activity in Studio. In this video, you will learn
to create a workflow that displays the names
of all the files in a folder in the output panel. Let's begin. As you can see, this folder named as Files
contains multiple documents. This folder will
be used to display the names of the files
in the output panel. Start with searching for the Browse for
Folder activity in the activities panel and drag and drop it in
the designer panel. Let's rename the
sequence activity as For Each and add an
annotation to it. Rename the Browse for
Folder activity also. From the variables panel, create a variable
called folder name. Variable type is string and
scope and sequence for each. Navigate to the
properties panel of the Browse for Folder
activity and enter the variable folder name in
the selected folder property. Insert an Assign activity
below the browse for Folder activity and rename it. In the two text box, press "Control plus
K" to create a new variable and name
it as file list. Now navigate to the
properties panel of the Assign activity. Click the ellipsis icon of the value field to open the
expression editor window. Now type Directory.GetFiles
folder name. Please ensure that the
folder name is specified in parentheses. Click "Okay". From the variables panel, select file list variable, and change its variable
type to array of string and set its scope
to sequence For Each. Insert, For Each activity below the Assign activity,
and rename it. Type item in the first
text box of the For Each activity and the
variable file list in the second text box. Search for a write
line activity in the activities panel and drag and drop it in the body
section of the For Each activity and rename it. Enter the text item.ToString
in its textbox. Click "Save" to save
the project and run it. From the pop-up window, select a folder, files which was at the
start of the video. Go to the output panel
to see the result. The list of file
names is displayed from the selected
folder successfully. It is encouraged to
create the workflow as demonstrated and
try this activity. Thank you for watching.